<?php

class Controller_Admin_User_Password  extends Controller_Admin_Abstract
{
	function execute($request)
	{
		$form = new Form_Admin_User_Password;

		$id = (int)$request -> getParam('_id');

		$user = Mongo_Document::factory('user', $id);

		if ($request -> isPost() && $form -> isValid($_POST))
		{
			$value = $form -> getValues();
			$user -> setPassword($value['password']);
			$user -> save();
		}
		$request -> response = View::render($data = array('form' => $form), 'controller/admin/edit.tpl');
	}

}
